"""
    实现在【门店管理】下新增门店接口对象封装
"""
import requests
import random


class ApiCreateStore(object):
    def api_create_store(self, url, token):
        # 定义请求头
        headers = {"Content-Type": "application/json", "Authorization": token}
        # 定义请求体，可在请求体中使用函数
        data = {
            "address": "详细地址",
            "aisleMax": 33,
            "aisleMin": 22,
            "aislePass": 55,
            "aisleTotal": 44,
            "brokerName": "门店联系人",
            "brokerPhone": 13811110000,
            "countryCode": "1070000",
            "countryName": "关岛",
            "floorHeight": "<=5m",
            "isChannelOver80cm": "true",
            "isGroundFlat": "true",
            "isNiceForRobot": "true",
            "isNoElevator": "true",
            "isNoSlope": "true",
            "latitude": 13.444304,
            "longitude": 144.793731,
            "lora": "LoRa通道",
            "name": "自动化门店" + str(random.randint(50, 9999)),
            "primaryIndustryCode": "scenes_cbd",
            "regionId": "ap-northeast-1",
            "rockoverRate": 3,
            "secondIndustryCode": "scenes_cbd_1",
            "shopArea": 11,
            "shopTable": 1,
            "siteStartTime": "2022-08-22 16:08:59",
            "unitPrice": 2,
            "userId": "76274c5ea988427883180a2438ca74a5",
            "waiterAvgSalary": 400,
            "waiterFlat": 21,
            "waiterPeak": 22,
            "waiterTotal": 23
        }
        # s = requests.post(url, headers=headers, json=data)
        # print(s.json())

        return requests.post(url, headers=headers, json=data)